//
//  BaseDataModel.m
//  大概是豆瓣
//
//  Created by 甘霞 on 15/10/7.
//  Copyright © 2015年 甘霞. All rights reserved.
//

#import "BaseDataModel.h"

@implementation BaseDataModel

//对象初始化
- (instancetype)initWithDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

//类初始化
+ (instancetype)modelWithDic:(NSDictionary *)dic
{
    return [[self alloc] initWithDic:dic] ;
}

//字典转模型
+ (NSMutableArray *)transformWithArray:(NSArray *)array
{
    NSMutableArray *tempArr = [NSMutableArray array];
    for (NSDictionary *dic in array) {
        id temp = [self modelWithDic:dic];
        [tempArr addObject:temp];
    }
    return tempArr;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

@end
